package main

import (
	"flag"
	"log"
	"net/http"
	"socketio/ws"
)

// 打包命令
// ### windows打包
// CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -H windowsgui"  main.go

func main() {
	port := flag.String("p", "8081", "http listen port") // 自定义端口
	flag.Parse()

	http.HandleFunc("/ws", ws.RunWsServer)

	log.Printf("Listening and serving HTTP on :%s\n", *port)
	if err := http.ListenAndServe(":"+*port, nil); err != nil {
		log.Fatalln(err.Error())
	}
}
